let app = new Vue({
	el: ".row",
	data: {
		getList : "",
		flag : false,
		shuliang : ""
	},
	created() {
		this.xiala()
	},
	methods:{
		xiala(){
			console.log(this.getQueryString("id"));
			let data = new URLSearchParams;
			data.append("id",this.getQueryString("id"));
			
			axios({
				url : "cangku/selectById",
				method : "post",
				data : data,
				headers:{"token":localStorage.token,"url":window.location.pathname}
			}).then(response=>{
				
				this.getList=response.data.data;
				console.log(this.getList);
				
			})
		},
		getQueryString(name) {
		     return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ""])[1].replace(/\+/g, '%20')) || null;
		 },
		search(event){
			let repertory= event.currentTarget.value;
			var type = /^[0-9]*[1-9][0-9]*$/;
			            var re = new RegExp(type);
			            if(repertory.match(re)==null){
							this.flag=true;
							return;
						}
						this.flag=false;
						
		},
		tijiao(){
			var type = /^[0-9]*[1-9][0-9]*$/;
			console.log(this.shuliang)
			var re = new RegExp(type);
			if(this.shuliang.match(re)==null){
				return;
			}
			let data = new URLSearchParams; 
			data.append("id",this.getQueryString("id"));
			data.append("jia",this.shuliang);
			data.append("jian",0);
			axios({
				url : "cangku/storeManagementJiaJian",
				method : "post",
				data : data,
				headers:{"token":localStorage.token,"url":window.location.pathname}
			}).then(rsponse=>{
				if(rsponse.data.data){
					alert("添加成功");
					
				}else{
					alert("添加失败");
				}
			})
			
		}
	}
})